﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAO;
using DVO;

public partial class CommentDoc : System.Web.UI.Page
{
    public int _DocId = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.User.Identity.Name=="")
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            if (!String.IsNullOrEmpty(Request.QueryString["Id"]))
            {
                _DocId = Convert.ToInt32(Request.QueryString["Id"].ToString());
            }
            if (IsPostBack == false)
            {
                if (_DocId > 0)
                {
                    LoadData(_DocId);
                }
            }
        }
       
    }

    private void LoadData(int Id)
    {
        BLL_Working ObjBLL = new BLL_Working();
        List<ins_Comment_SelectByDocIdResult> ObjList = new List<ins_Comment_SelectByDocIdResult>();
        ObjList = ObjBLL.Comment_SelectById(Id).ToList();
        grid.DataSource = ObjList;
        grid.DataBind();
    }

    public string GetStatus(string Status)
    {
        if (Status == "0")
            return "Chờ kiểm duyệt";
        else if (Status == "1")
            return "Đã duyệt";
        else if (Status == "2")
            return "Chờ review";
        else if (Status == "3")
            return "Chỉnh sửa";
        return "";
    }
    protected void grid_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grid.PageIndex = e.NewPageIndex;
        LoadData(_DocId);
    }
}